package com.authority;


public class AuthorityButtonDemo {
    public static void main(String[] args){
        Authority authority = new Authority("食品科学与工程", "257c950jfae04d6799b91722930bl9f74");

        AuthorityButton authorityButton=new AuthorityButton();

        authorityButton.add(authority);
        authorityButton.list();

    }
}
class AuthorityButton{
    private Authority auth=new Authority("","");

    //添加
    public void add(Authority authority){
        //因为head节点不能动，因此我们需要一个辅助遍历temp
        Authority temp =auth;
        //遍历链表，找到最后
        while (true){
            //找到链表的最后
            if (temp.next==null){
                break;
            }
            //如果没有找到最后的，将temp后移
            temp=temp.next;
        }
        //但退出while循环时，temp就指向链表的最后
        //将最后的这个节点的next指向新的节点
        temp.next=authority;
    }
   // 显示链表（通过遍历）
    public void list(){
        //判断链表的是否为空
        if(auth.next==null){
            System.out.println("链表为空");
            return;
        }
        //因为头节点不能动，因此我们需要一个辅助变量来遍历
        Authority temp=auth.next;
        while (true){
            //判断是否到链表最后
            if (temp==null){
                break;
            }
            //输出节点信息
            System.out.println(temp);
            //将temp后移，一定要小心，不然就是个死循环
            temp=temp.next;
        }
    }
}


class Authority{
    public String pid;
    public String name;
    public Authority next;//指向下一个节点

    //构造器
    public Authority(String pid,String name){
        this.pid=pid;
        this.name=name;
    }
    //为了显示方便 重新写下toString
    @Override
    public String toString(){//prBidding:add
        return /*"UPDATE sys_permission SET,\n" +*/
           /*     "INSERT INTO  `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`,`perms_type`,`status`) VALUES\n" +
                "('b_"+name+"_add','"+pid+"','添加',NULL,NULL,NULL,NULL,2,'"+name+":add',1.00,0,NULL,1,1,0,NULL,'admin','2019-05-11 14:19:19',NULL,NULL,0,1,1);\n\n" +
                "INSERT INTO  `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`,`perms_type`,`status`) VALUES\n"+
                "('b_"+name+"_edit','"+pid+"','编辑',NULL,NULL,NULL,NULL,2,'"+name+":edit',1.00,0,NULL,1,1,0,NULL,'admin','2019-05-11 14:19:19',NULL,NULL,0,1,1);\n\n" +
                "INSERT INTO  `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`,`perms_type`,`status`) VALUES\n" +
                "('b_"+name+"_list','"+pid+"','查询',NULL,NULL,NULL,NULL,2,'"+name+":list',1.00,0,NULL,1,1,0,NULL,'admin','2019-05-11 14:19:19',NULL,NULL,0,1,1);\n\n" +
                "INSERT INTO  `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`,`perms_type`,`status`) VALUES\n" +
                "('b_"+name+"_delete','"+pid+"','删除',NULL,NULL,NULL,NULL,2,'"+name+":delete',1.00,0,NULL,1,1,0,null,'admin','2019-05-11 14:19:19',NULL,NULL,0,1,1);\n\n" +
                "INSERT INTO  `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`,`perms_type`,`status`) VALUES\n" +
                "('b_"+name+"_deleteBatch','"+pid+"','批量删除',NULL,NULL,NULL,NULL,2,'"+name+":deleteBatch',1.00,0,NULL,1,1,0,NULL,'admin','2019-05-11 14:19:19',NULL,NULL,0,1,1);\n\n" +
                "INSERT INTO  `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`,`perms_type`,`status`) VALUES\n" +
                "('b_"+name+"_queryById','"+pid+"','单个查询',NULL,NULL,NULL,NULL,2,'"+name+":queryById',1.00,0,NULL,1,1,0,NULL,'admin','2019-05-11 14:19:19',NULL,NULL,0,1,1);\n\n" +
                "INSERT INTO  `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`,`perms_type`,`status`) VALUES\n" +
                "('b_"+name+"_export','"+pid+"','导出数据',NULL,NULL,NULL,NULL,2,'"+name+":export',1.00,0,NULL,1,1,0,NULL,'admin','2019-05-11 14:19:19',NULL,NULL,0,1,1);\n\n" +
                "INSERT INTO  `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`,`perms_type`,`status`) VALUES\n" +
                "('b_"+name+"_importE','"+pid+"','导入数据',NULL,NULL,NULL,NULL,2,'"+name+":importE',1.00,0,NULL,1,1,0,NULL,'admin','2019-05-11 14:19:19',NULL,NULL,0,1,1);";*/

                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"91', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"191', '0', '9', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"81', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"181', '0', '8', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"71', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"171', '0', '7', '0');\n\n" +
                 "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"61', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"161', '0', '6', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"51', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"151', '0', '5', '0');\n\n" +

                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"92', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"192', '0', '9', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"82', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"182', '0', '8', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"72', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"172', '0', '7', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"62', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"162', '0', '6', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"52', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"152', '0', '5', '0');\n\n" +

                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"93', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"193', '0', '9', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"83', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"183', '0', '8', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"73', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"173', '0', '7', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"63', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"163', '0', '6', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"53', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"153', '0', '5', '0');\n\n" +

                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"94', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"194', '0', '9', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"84', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"184', '0', '8', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"74', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"174', '0', '7', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"64', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"164', '0', '6', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"54', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"154', '0', '5', '0');\n\n" +

                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"95', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"195', '0', '9', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"85', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"185', '0', '8', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"75', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"175', '0', '7', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"65', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"165', '0', '6', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"55', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"155', '0', '5', '0');\n\n" +

                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"96', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"196', '0', '9', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"86', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"186', '0', '8', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"76', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"176', '0', '7', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"66', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"166', '0', '6', '0');\n\n" +
                "INSERT INTO `schoolsj`.`st_class` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `college`, `profession`, `classes`, `field_one`, `field_two`, `deleted`) VALUES \n" +
                "('"+name+"56', 'admin', '2019-11-06 14:43:26', 'admin', '2019-12-11 14:17:22', 'A04', '257c9507fae04d6799b91722930b39f7', '"+name+"', '"+pid+"156', '0', '5', '0');";

    }

}





















